/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VentanaPersona.java
 *
 * Created on 24/07/2011, 12:34:39 AM
 */
package co.srm.vistas.funcionales;

import co.srm.entidades.Cliente;
import co.srm.entidades.Cobrador;
import co.srm.entidades.Empresa;
import co.srm.entidades.Persona;
import co.srm.entidades.Rol;
import co.srm.entidades.Usuario;
import co.srm.manejadores.ManejadorCliente;
import co.srm.manejadores.ManejadorCobrador;
import co.srm.manejadores.ManejadorEmpresa;
import co.srm.manejadores.ManejadorPago;
import co.srm.manejadores.ManejadorPersona;
import co.srm.manejadores.ManejadorRol;
import co.srm.manejadores.ManejadorUsuario;
import co.srm.utilidades.Control;
import co.srm.utilidades.TipoPersona;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;

/**
 *
 * @author JORGE
 */
public class VentanaPersona extends javax.swing.JDialog {

    public static boolean isRegistroPrestamo = false;
    public static Usuario usuariost;
    public static Cobrador cobradorst;
    public static Cliente clientestP;
    public static String idThePrestamo;

    public static int origenVentanaPersona = 0;
     ManejadorPersona mper = null;
    /** Creates new form VentanaPersona */
    public VentanaPersona(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        setLocationRelativeTo(null);
        inicializar();

    }

    public final void inicializar() {
        campoFecha.setVisible(false);
        campoIdCliente.setVisible(false);
        cargarEmpresa();
        ComboBoxModel cbModel = new DefaultComboBoxModel(TipoPersona.values());
        comboTipo.setModel(cbModel);
        comboTipo.setSelectedIndex(1);
        if (isRegistroPrestamo) {
            comboTipo.setSelectedIndex(1);
            campoIdentificacion.setText(idThePrestamo);
        }
        jLabelIdentificacion.setDisplayedMnemonic('i');
        campoIdentificacion.setFocusAccelerator('i');
        jlabelApellido.setDisplayedMnemonic('a');
        campoApellido.setFocusAccelerator('a');
        jlabelNombre.setDisplayedMnemonic('n');
        campoNombre.setFocusAccelerator('n');
        
       mper = new ManejadorPersona();
    }
 
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jXPanel1 = new org.jdesktop.swingx.JXPanel();
        jLabelIdentificacion = new javax.swing.JLabel();
        jlabelNombre = new javax.swing.JLabel();
        jlabelApellido = new javax.swing.JLabel();
        campoIdentificacion = new javax.swing.JTextField();
        campoNombre = new javax.swing.JTextField();
        campoApellido = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        campoTelefono = new javax.swing.JTextField();
        campoCelular = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        areaDireccion = new javax.swing.JTextArea();
        campoFecha = new org.jdesktop.swingx.JXDatePicker();
        jLabel12 = new javax.swing.JLabel();
        comboTipo = new javax.swing.JComboBox();
        labelEmpresa = new javax.swing.JLabel();
        comboEmpresa = new javax.swing.JComboBox();
        campoIdCliente = new javax.swing.JTextField();
        jXPanel3 = new org.jdesktop.swingx.JXPanel();
        jLabel13 = new javax.swing.JLabel();
        tabPanel = new javax.swing.JTabbedPane();
        panelUsuario = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        campoUsuario = new javax.swing.JTextField();
        campoContraseña = new javax.swing.JPasswordField();
        campoReContraseña = new javax.swing.JPasswordField();
        jLabel11 = new javax.swing.JLabel();
        comboRol = new javax.swing.JComboBox();
        ChecSelect = new javax.swing.JCheckBox();
        panelCliente = new javax.swing.JPanel();
        jLabel14 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        areaObservacion = new javax.swing.JTextArea();
        jXPanel4 = new org.jdesktop.swingx.JXPanel();
        guardarPersona = new javax.swing.JButton();
        botonModificar = new javax.swing.JButton();
        jLabel15 = new javax.swing.JLabel();
        botonListadoUsuarios = new javax.swing.JButton();
        botonListadoCobradores = new javax.swing.JButton();
        botonListadoClientes = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jXPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Datos Personales", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12))); // NOI18N

        jLabelIdentificacion.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelIdentificacion.setText("Identificacion");

        jlabelNombre.setFont(new java.awt.Font("Arial", 0, 12));
        jlabelNombre.setText("Nombre");

        jlabelApellido.setFont(new java.awt.Font("Arial", 0, 12));
        jlabelApellido.setText("Apellido");

        campoIdentificacion.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                campoIdentificacionFocusLost(evt);
            }
        });
        campoIdentificacion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                campoIdentificacionKeyTyped(evt);
            }
        });

        jLabel4.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel4.setText("Telefono");

        jLabel5.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel5.setText("Celular");

        jLabel6.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel6.setText("Direccion");

        areaDireccion.setColumns(20);
        areaDireccion.setRows(5);
        jScrollPane1.setViewportView(areaDireccion);

        jLabel12.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel12.setText("Tipo");

        comboTipo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboTipoActionPerformed(evt);
            }
        });

        labelEmpresa.setFont(new java.awt.Font("Arial", 0, 12));
        labelEmpresa.setText("Empresa");

        javax.swing.GroupLayout jXPanel1Layout = new javax.swing.GroupLayout(jXPanel1);
        jXPanel1.setLayout(jXPanel1Layout);
        jXPanel1Layout.setHorizontalGroup(
            jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelIdentificacion)
                    .addComponent(jlabelNombre)
                    .addComponent(jLabel4)
                    .addComponent(labelEmpresa))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(comboEmpresa, 0, 217, Short.MAX_VALUE)
                    .addComponent(campoTelefono, javax.swing.GroupLayout.DEFAULT_SIZE, 217, Short.MAX_VALUE)
                    .addGroup(jXPanel1Layout.createSequentialGroup()
                        .addComponent(campoIdentificacion, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(campoFecha, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(campoIdCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(campoNombre, javax.swing.GroupLayout.DEFAULT_SIZE, 217, Short.MAX_VALUE))
                .addGap(23, 23, 23)
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addComponent(jlabelApellido)
                    .addComponent(jLabel12)
                    .addComponent(jLabel6))
                .addGap(18, 18, 18)
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 246, Short.MAX_VALUE)
                    .addComponent(comboTipo, javax.swing.GroupLayout.Alignment.LEADING, 0, 246, Short.MAX_VALUE)
                    .addComponent(campoApellido, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 246, Short.MAX_VALUE)
                    .addComponent(campoCelular, javax.swing.GroupLayout.DEFAULT_SIZE, 246, Short.MAX_VALUE))
                .addGap(39, 39, 39))
        );
        jXPanel1Layout.setVerticalGroup(
            jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel1Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabelIdentificacion)
                        .addComponent(campoIdentificacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(campoFecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(campoIdCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel12)
                        .addComponent(comboTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlabelNombre)
                    .addComponent(jlabelApellido)
                    .addComponent(campoNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoApellido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5)
                    .addComponent(campoTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoCelular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6)
                    .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(labelEmpresa)
                        .addComponent(comboEmpresa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE))
                .addContainerGap())
        );

        jXPanel3.setBackground(new java.awt.Color(255, 220, 98));

        jLabel13.setFont(new java.awt.Font("Arial", 3, 18));
        jLabel13.setForeground(new java.awt.Color(51, 51, 51));
        jLabel13.setText("Registro De Personas");

        javax.swing.GroupLayout jXPanel3Layout = new javax.swing.GroupLayout(jXPanel3);
        jXPanel3.setLayout(jXPanel3Layout);
        jXPanel3Layout.setHorizontalGroup(
            jXPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel3Layout.createSequentialGroup()
                .addGap(356, 356, 356)
                .addComponent(jLabel13)
                .addContainerGap(422, Short.MAX_VALUE))
        );
        jXPanel3Layout.setVerticalGroup(
            jXPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel13)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        tabPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder()));

        jLabel7.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel7.setText("Usuario");

        jLabel8.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel8.setText("Contraseña");

        jLabel9.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel9.setText("Repite Contraseña");

        jLabel11.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel11.setText("Rol");

        ChecSelect.setFont(new java.awt.Font("Arial", 1, 12));
        ChecSelect.setText("Habilitar Campos");
        ChecSelect.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ChecSelectActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelUsuarioLayout = new javax.swing.GroupLayout(panelUsuario);
        panelUsuario.setLayout(panelUsuarioLayout);
        panelUsuarioLayout.setHorizontalGroup(
            panelUsuarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelUsuarioLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelUsuarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel9)
                    .addComponent(jLabel7)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelUsuarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(campoContraseña, javax.swing.GroupLayout.DEFAULT_SIZE, 144, Short.MAX_VALUE)
                    .addComponent(campoReContraseña, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 144, Short.MAX_VALUE)
                    .addComponent(campoUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(40, 40, 40)
                .addComponent(jLabel11)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(comboRol, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ChecSelect)
                .addGap(18, 18, 18))
        );
        panelUsuarioLayout.setVerticalGroup(
            panelUsuarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelUsuarioLayout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addGroup(panelUsuarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel7)
                    .addGroup(panelUsuarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(campoUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel11)
                        .addComponent(ChecSelect)
                        .addComponent(comboRol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(panelUsuarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(campoContraseña, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(panelUsuarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(campoReContraseña, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(37, Short.MAX_VALUE))
        );

        tabPanel.addTab("Datos Usuario", panelUsuario);

        jLabel14.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel14.setText("Observacion");

        areaObservacion.setColumns(20);
        areaObservacion.setRows(5);
        jScrollPane2.setViewportView(areaObservacion);

        javax.swing.GroupLayout panelClienteLayout = new javax.swing.GroupLayout(panelCliente);
        panelCliente.setLayout(panelClienteLayout);
        panelClienteLayout.setHorizontalGroup(
            panelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel14)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 548, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(39, Short.MAX_VALUE))
        );
        panelClienteLayout.setVerticalGroup(
            panelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelClienteLayout.createSequentialGroup()
                .addGap(32, 32, 32)
                .addGroup(panelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
                    .addComponent(jLabel14))
                .addContainerGap(70, Short.MAX_VALUE))
        );

        tabPanel.addTab("Datos Clientes", panelCliente);

        jXPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        guardarPersona.setFont(new java.awt.Font("Arial", 1, 12));
        guardarPersona.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/srm/vistas/iconos/guardaricono.png"))); // NOI18N
        guardarPersona.setText("Guardar");
        guardarPersona.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                guardarPersonaActionPerformed(evt);
            }
        });

        botonModificar.setFont(new java.awt.Font("Arial", 1, 12));
        botonModificar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/srm/vistas/iconos/modificar.png"))); // NOI18N
        botonModificar.setText("Modificar");
        botonModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonModificarActionPerformed(evt);
            }
        });

        jLabel15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/srm/vistas/iconos/SRM_logo_66x66.png"))); // NOI18N
        jLabel15.setBorder(javax.swing.BorderFactory.createEtchedBorder(java.awt.Color.lightGray, java.awt.Color.lightGray));

        botonListadoUsuarios.setFont(new java.awt.Font("Arial", 1, 12));
        botonListadoUsuarios.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/srm/vistas/iconos/community-users-icon2.png"))); // NOI18N
        botonListadoUsuarios.setText("Listado Usuarios");
        botonListadoUsuarios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonListadoUsuariosActionPerformed(evt);
            }
        });

        botonListadoCobradores.setFont(new java.awt.Font("Arial", 1, 12));
        botonListadoCobradores.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/srm/vistas/iconos/community-users-icon2.png"))); // NOI18N
        botonListadoCobradores.setText("Listado Cobradores");
        botonListadoCobradores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonListadoCobradoresActionPerformed(evt);
            }
        });

        botonListadoClientes.setFont(new java.awt.Font("Arial", 1, 12));
        botonListadoClientes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/co/srm/vistas/iconos/community-users-icon2.png"))); // NOI18N
        botonListadoClientes.setText("Listado De Clientes");
        botonListadoClientes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonListadoClientesActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jXPanel4Layout = new javax.swing.GroupLayout(jXPanel4);
        jXPanel4.setLayout(jXPanel4Layout);
        jXPanel4Layout.setHorizontalGroup(
            jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jXPanel4Layout.createSequentialGroup()
                        .addComponent(botonListadoCobradores, javax.swing.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(jXPanel4Layout.createSequentialGroup()
                        .addComponent(botonModificar, javax.swing.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(jXPanel4Layout.createSequentialGroup()
                        .addComponent(guardarPersona, javax.swing.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jXPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel15)
                        .addGap(68, 68, 68))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jXPanel4Layout.createSequentialGroup()
                        .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(botonListadoClientes, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE)
                            .addComponent(botonListadoUsuarios, javax.swing.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE))
                        .addContainerGap())))
        );
        jXPanel4Layout.setVerticalGroup(
            jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jXPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel15)
                .addGap(46, 46, 46)
                .addComponent(botonListadoClientes)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(botonListadoUsuarios)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(botonListadoCobradores)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE)
                .addComponent(guardarPersona)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(botonModificar, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(54, 54, 54))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(tabPanel, 0, 0, Short.MAX_VALUE)
                    .addComponent(jXPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addComponent(jXPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addComponent(jXPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jXPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(27, 27, 27)
                        .addComponent(jXPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(tabPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 203, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jXPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void campoIdentificacionKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_campoIdentificacionKeyTyped
        // TODO add your handling code here:
        Control.validaNumeros(evt, campoIdentificacion,11);
    }//GEN-LAST:event_campoIdentificacionKeyTyped

    private void guardarPersonaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guardarPersonaActionPerformed
        // TODO add your handling code here:
 if( !campoIdentificacion.getText().isEmpty() && !campoNombre.getText().isEmpty() && !campoApellido.getText().isEmpty()){
        String identificacion = campoIdentificacion.getText();
        String nombre = campoNombre.getText();
        String apellido = campoApellido.getText();
        String telefono = campoTelefono.getText();
        String celular = campoCelular.getText();
        String direccion = areaDireccion.getText();
        Date fecha = campoFecha.getDate();
        String usuario = campoUsuario.getText();
        String contraseña = campoContraseña.getText();  //.getPassword().toString()
        Empresa emp = (Empresa) comboEmpresa.getSelectedItem();
        Rol rol = (Rol) comboRol.getSelectedItem();
        // if(!campoIdentificacion.getText().isEmpty() && !campoNombre.getText().isEmpty() && !campoApellido.getText().isEmpty() ){
          ManejadorPersona mper = new ManejadorPersona();
           Persona persona = null;
           persona = mper.consultarPersonaByIdentificacion(campoIdentificacion.getText());
           if(persona != null){
    JOptionPane.showMessageDialog(null,persona.getNombres()+" "+persona.getApellidos() + "Se encuentra Registrado","Persona Ya Existe",JOptionPane.INFORMATION_MESSAGE);
          }else{
   
// selecciono el tipo usuario
        if (comboTipo.getSelectedIndex() == 0) {
            ManejadorUsuario mU = new ManejadorUsuario();
            boolean guardo = mU.crearUsuario(null, identificacion, fecha, nombre, apellido, telefono, celular, direccion, usuario, contraseña, rol, emp, false);
            if (guardo) {
                JOptionPane.showMessageDialog(null, "Usuario Registrado Exitosamente", "Registro De Usuario", JOptionPane.INFORMATION_MESSAGE);
                limpiar();
            } else {
                
                JOptionPane.showMessageDialog(null, "No se pudo registrar el usuario", "Registro De Usuario", JOptionPane.WARNING_MESSAGE);

            }
        } // selecciono el tipo cliente
        else if (comboTipo.getSelectedIndex() == 1) {
            String Observacion = areaObservacion.getText();
            ManejadorCliente mC = new ManejadorCliente();
            if (isRegistroPrestamo ) {
                enviarCliente("", "", "", "", "");
            }
            boolean guardo = mC.crearCliente(null, identificacion, fecha, nombre, apellido, telefono, celular, direccion, Observacion, false);
            if (guardo) {
                JOptionPane.showMessageDialog(null, "Cliente Registrado Exitosamente", "Registro De Cliente", JOptionPane.INFORMATION_MESSAGE);
                limpiar();
                if (isRegistroPrestamo ) {
                    enviarCliente("", identificacion, nombre, telefono + "/" + celular, direccion);
                    VentanaPrestamo.clienteSt=ManejadorCliente.lastClienteInsert;
                    this.setVisible(false);
                }
            } else {
                JOptionPane.showMessageDialog(null, "No se pudo registrar el cliente", "Registro De Cliente", JOptionPane.WARNING_MESSAGE);
            }
        } // selecciono el tipo cobrador
        else if (comboTipo.getSelectedIndex() == 2) {
            ManejadorCobrador mCo = new ManejadorCobrador();
            boolean guardo = mCo.crearCobrador(null, identificacion, fecha, nombre, apellido, telefono, celular, direccion,emp, false);
            if (guardo) {
                JOptionPane.showMessageDialog(null, "Cobrador Registrado Exitosamente", "Registro De Cobradores", JOptionPane.INFORMATION_MESSAGE);
            limpiar();
            } else {
                JOptionPane.showMessageDialog(null, "No se pudo registrar el Cobrador", "Registro De Cobradores", JOptionPane.WARNING_MESSAGE);
            }
        }
       }// fin del else
 // fin del si es vacio
   }else{
   Control.mensajeJOption("Existe al Menos un Campo Obligatorio Vacio", "Campos Vacios",15);
   }

    }//GEN-LAST:event_guardarPersonaActionPerformed

    public void enviarCliente(String id, String cedula, String nombre, String telefonos, String direccion) {
        VentanaPrestamo.campoIdCliente.setText(String.valueOf(id));
        VentanaPrestamo.campoCedula.setText(cedula);
        VentanaPrestamo.campoNombre.setText(nombre);
        VentanaPrestamo.campoTelefono.setText(telefonos);
        VentanaPrestamo.areaDireccion.setText(direccion);

    }
    private void comboTipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboTipoActionPerformed
        // TODO add your handling code here:

        // Usuario
        if (comboTipo.getSelectedIndex() == 0) {
////            tabPanel.getTabComponentAt(0).setVisible(true);
            comboEmpresa.setVisible(true);
            labelEmpresa.setVisible(true);
            tabPanel.setEnabledAt(0, true);
            botonListadoUsuarios.setVisible(true);
            botonListadoCobradores.setVisible(false);
            botonListadoClientes.setVisible(false);
            tabPanel.setSelectedIndex(0);
            tabPanel.setEnabledAt(1, false);
            Control.disableAndEnabledContainer(tabPanel, true);
            botonModificar.setEnabled(false);
            limpiar();
            cargarRoles();

        } // Cliente
        else if (comboTipo.getSelectedIndex() == 1) {
            botonListadoUsuarios.setVisible(false);
            botonListadoCobradores.setVisible(false);
             botonListadoClientes.setVisible(true);
            comboEmpresa.setVisible(false);
            labelEmpresa.setVisible(false);
            tabPanel.setEnabledAt(0, false);
            tabPanel.setEnabledAt(1, true);
            tabPanel.setSelectedIndex(1);
            Control.disableAndEnabledContainer(tabPanel, true);
              comboEmpresa.setVisible(false);
            labelEmpresa.setVisible(false);
            botonModificar.setEnabled(false);
            limpiar();
        } // Cobrador
        else if (comboTipo.getSelectedIndex() == 2) {
            botonListadoCobradores.setVisible(true);
            botonListadoUsuarios.setVisible(false);
             botonListadoClientes.setVisible(false);
            tabPanel.setEnabledAt(0, false);
            tabPanel.setEnabledAt(1, false);
            comboEmpresa.setVisible(true);
            labelEmpresa.setVisible(true);
            Control.disableAndEnabledContainer(tabPanel, false);
            botonModificar.setEnabled(false);
            limpiar();
        }
    }//GEN-LAST:event_comboTipoActionPerformed

    private void campoIdentificacionFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_campoIdentificacionFocusLost
        // TODO add your handling code here:
        if (!campoIdentificacion.getText().isEmpty()) {
            ManejadorPersona mper = new ManejadorPersona();
            Persona persona = null;
            persona = mper.consultarPersonaByIdentificacion(campoIdentificacion.getText());
            if (persona != null) {
                String tipopersona = persona.getClass().getSimpleName();
                if (tipopersona.equals("Cobrador")) {
                    limpiar2();
                    comboTipo.setSelectedIndex(2);
                    Cobrador cobrador = (Cobrador) persona;
                    comboEmpresa.setSelectedItem(cobrador.getEmpresa());
                }
                if (tipopersona.equals("Cliente")) {
                    limpiar2();
                    comboTipo.setSelectedIndex(1);
                    Cliente cliente = (Cliente) persona;
                    areaObservacion.setText(cliente.getObservacion());
                }
                if (tipopersona.equals("Usuario")) {
                    limpiar2();
                    comboTipo.setSelectedIndex(0);
                    Usuario usuario = (Usuario) persona;
                    comboEmpresa.setSelectedItem(usuario.getEmpresa());
                    campoUsuario.setText(usuario.getLogin());
                    campoContraseña.setText(usuario.getClave());
                    campoReContraseña.setText(usuario.getClave());
                    comboRol.setSelectedItem(usuario.getRoles().get(0));
                }
                guardarPersona.setEnabled(false);
                botonModificar.setEnabled(true);
                campoNombre.setText(persona.getNombres());
                campoApellido.setText(persona.getApellidos());
                campoTelefono.setText(persona.getTelefono());
                areaDireccion.setText(persona.getDireccion());
                campoCelular.setText(persona.getCelular());
                campoIdentificacion.setText(persona.getIdentificacion().toString());
            } else {
                limpiar2();
                botonModificar.setEnabled(false);
                guardarPersona.setEnabled(true);
            }
        } else {
//            Control.mensajeJOption(" Por favor ingrese una Identificacion", "Campos Vacios", 15);
        }
    }//GEN-LAST:event_campoIdentificacionFocusLost

    private void botonListadoUsuariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonListadoUsuariosActionPerformed
        // TODO add your handling code here:
        new BusquedaUsuario(null, true).setVisible(true);
    }//GEN-LAST:event_botonListadoUsuariosActionPerformed

    private void ChecSelectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ChecSelectActionPerformed
        // TODO add your handling code here:
        if ( ChecSelect.isSelected()){
            Control.disableAndEnabledContainer(panelUsuario,true);
        }else{
            Control.disableAndEnabledContainer(panelUsuario,false);
            ChecSelect.setEnabled(true);
        }
    }//GEN-LAST:event_ChecSelectActionPerformed

    
    
    private void botonModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonModificarActionPerformed
        // TODO add your handling code here:
     if( !campoIdentificacion.getText().isEmpty() && !campoNombre.getText().isEmpty() && !campoApellido.getText().isEmpty()){
        // Seleccionado el tipo Usuario
        if(comboTipo.getSelectedIndex()==0){
            System.out.println("comboTipo.getSelectedIndex() = " + comboTipo.getSelectedIndex());
            System.out.println("comboRol.getSelectedIndex() = " + comboRol.getSelectedIndex());
            ManejadorUsuario mUsu = new ManejadorUsuario();
            Usuario u = null;
//            u = usuariost;
            if (usuariost!= null){
                u = usuariost;
            } else {
                try {
                    u = mUsu.consultarUsuarioByIdentificacion(campoIdentificacion.getText());
                } catch (Exception ex) {
                    Logger.getLogger(VentanaPersona.class.getName()).log(Level.SEVERE, null, ex);
                    ex.printStackTrace();
                }
            }
            if (campoUsuario.getText().isEmpty() || campoContraseña.getText().isEmpty() || campoReContraseña.getText().isEmpty() || campoIdentificacion.getText().isEmpty() || campoNombre.getText().isEmpty() || campoApellido.getText().isEmpty()) {
                Control.mensajeJOption(" Existe al menos un Campo Obligatorio Vacio", "Campos Vacios", 15);
            } else {
                     u.setLogin(campoUsuario.getText().trim());
                u.setIdentificacion(Integer.parseInt(campoIdentificacion.getText().trim()));
                u.setNombres(campoNombre.getText().trim());
                u.setApellidos(campoApellido.getText().trim());
                u.setTelefono(campoTelefono.getText().trim());
                u.setCelular(campoCelular.getText().trim());
                 String direc = (areaDireccion.getText().isEmpty()?"No Suministrada":areaDireccion.getText());
                u.setDireccion(direc);
                u.setClave(campoContraseña.getText().trim());
                System.out.println("u.getClave() = " + u.getClave());
               Empresa emp = (Empresa) comboEmpresa.getSelectedItem();
               Rol rol = (Rol) comboRol.getSelectedItem();
               
               u.setEmpresa(emp);
               u.setRoles(rol);
                boolean estado = mUsu.actualizarUsuario(u);
                if (estado) {
                    JOptionPane.showMessageDialog(null, "Usuario Modificado con Exito", "Modificacion Exitosa", JOptionPane.INFORMATION_MESSAGE);
                    ChecSelect.setSelected(false);
                    guardarPersona.setEnabled(true);
                    botonModificar.setEnabled(false);
                    limpiar();
                } else {
                    JOptionPane.showMessageDialog(null, " No se completo la modificacion", "Modificacion Incompleta", JOptionPane.INFORMATION_MESSAGE);
                }
            }        // fin del usuario
      }else if(comboTipo.getSelectedIndex()==1){
         System.out.println(comboRol.getSelectedIndex());
         ManejadorCliente mCli = new ManejadorCliente();
         Cliente c = null;
         if(clientestP !=null){
             c=clientestP;
         }else{
          try{
            c = mCli.consultarUsuarioByIdentificacion(campoIdentificacion.getText());
          }catch(Exception ex){
          Logger.getLogger(VentanaPersona.class.getName()).log(Level.SEVERE, null, ex);
                    ex.printStackTrace();
          }
         }
        if (campoIdentificacion.getText().isEmpty() || campoNombre.getText().isEmpty() || campoApellido.getText().isEmpty()) {
                Control.mensajeJOption(" Existe al menos un Campo Obligatorio Vacio 2", "Campos Vacios", 15);
            } else {
              c.setIdentificacion(Integer.parseInt(campoIdentificacion.getText()));
              c.setNombres(campoNombre.getText());
                c.setApellidos(campoApellido.getText());
                c.setTelefono(campoTelefono.getText());
                c.setCelular(campoCelular.getText());
                String direc = (areaDireccion.getText().isEmpty()?"No Suministrada":areaDireccion.getText());
                c.setDireccion(direc);
                String obser = (areaObservacion.getText().isEmpty()?" Sin Observaciones":areaObservacion.getText());
               c.setObservacion(obser);
               boolean estado = mCli.actualizarCliente(c);
               if (estado) {
                    JOptionPane.showMessageDialog(null, "Cliente Modificado con Exito", "Modificacion Exitosa", JOptionPane.INFORMATION_MESSAGE);
                    guardarPersona.setEnabled(true);
                    botonModificar.setEnabled(false);
                    limpiar();
                } else {
                    JOptionPane.showMessageDialog(null, " No se completo la modificacion", "Modificacion Incompleta", JOptionPane.INFORMATION_MESSAGE);
                }
            }
        // fin del Cliente
      }else if (comboTipo.getSelectedIndex()==2){
            System.out.println(comboRol.getSelectedIndex());
            ManejadorCobrador mCo = new ManejadorCobrador();
            Cobrador c = null;
           if(cobradorst != null){
            c = cobradorst;
            } else{
                try{
            c = (Cobrador) mper.consultarPersonaByIdentificacion(campoIdentificacion.getText());
              } catch (Exception ex) {
                    Logger.getLogger(VentanaPersona.class.getName()).log(Level.SEVERE, null, ex);
                    ex.printStackTrace();
                }
              }
            if (campoIdentificacion.getText().isEmpty() || campoNombre.getText().isEmpty() || campoApellido.getText().isEmpty()) {
                Control.mensajeJOption(" Existe al menos un Campo Obligatorio Vacio 2", "Campos Vacios", 15);
            } else {
                c.setIdentificacion(Integer.parseInt(campoIdentificacion.getText()));
                c.setNombres(campoNombre.getText());
                c.setApellidos(campoApellido.getText());
                c.setTelefono(campoTelefono.getText());
                c.setCelular(campoCelular.getText());
                String direc = (areaDireccion.getText().isEmpty()?"No Suministrada":areaDireccion.getText());
                c.setDireccion(direc);
                Empresa emp = (Empresa) comboEmpresa.getSelectedItem();
                c.setEmpresa(emp);
               boolean estado = mCo.actualizarCobrador(c);
                if (estado) {
                    JOptionPane.showMessageDialog(null, "Cobrador Modificado con Exito", "Modificacion Exitosa", JOptionPane.INFORMATION_MESSAGE);
                    guardarPersona.setEnabled(true);
                    botonModificar.setEnabled(false);
                    limpiar();
                } else {
                    JOptionPane.showMessageDialog(null, " No se completo la modificacion", "Modificacion Incompleta", JOptionPane.INFORMATION_MESSAGE);
                }
            }
        // fin del Cobrador
        }
//        else {
//        botonModificar.setEnabled(false);
//        }
}else{
   Control.mensajeJOption("Existe al Menos un Campo Obligatorio Vacio", "Campos Vacios",15);
   }
    }//GEN-LAST:event_botonModificarActionPerformed

  

    private void botonListadoCobradoresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonListadoCobradoresActionPerformed
        // TODO add your handling code here:
        new BusquedaCobrador(null, true).setVisible(true);
    }//GEN-LAST:event_botonListadoCobradoresActionPerformed

    private void botonListadoClientesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonListadoClientesActionPerformed
        // TODO add your handling code here:
         origenVentanaPersona = 1;
//         System.out.println("origenVentanaPersona = " + origenVentanaPersona);
         new BusquedaCliente(null, true).setVisible(true);
                
    }//GEN-LAST:event_botonListadoClientesActionPerformed

    public void cargarRoles() {
        ManejadorRol mR = new ManejadorRol();
        List<Rol> roles = mR.todosLosRoles();

        for (Rol rol : roles) {
            comboRol.addItem(rol);
        }
    }

    public void cargarEmpresa() {
        ManejadorEmpresa mE = new ManejadorEmpresa();
        List<Empresa> empresas = mE.todasLasEmpresas();

        for (Empresa empresa : empresas) {
            comboEmpresa.addItem(empresa);

        }
    }

      public void limpiar() {
          campoNombre.setText("");
          campoIdentificacion.setText("");
          campoApellido.setText("");
          campoCelular.setText("");
          campoTelefono.setText("");
          areaDireccion.setText("");
          areaObservacion.setText("");
          campoUsuario.setText("");
          campoContraseña.setText("");
          campoReContraseña.setText("");
//          campoIdentificacion.transferFocus();
    }

      public void limpiar2() {
          campoNombre.setText("");
          campoApellido.setText("");
          campoCelular.setText("");
          campoTelefono.setText("");
          areaDireccion.setText("");
          areaObservacion.setText("");
          campoUsuario.setText("");
          campoContraseña.setText("");
          campoReContraseña.setText("");
    }      

    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                VentanaPersona dialog = new VentanaPersona(new javax.swing.JFrame(), true);
//                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
//                    public void windowClosing(java.awt.event.WindowEvent e) {
//                        System.exit(0);
//                    }
//                });
//                dialog.setVisible(true);
//            }
//        });
//    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public static javax.swing.JCheckBox ChecSelect;
    public static javax.swing.JTextArea areaDireccion;
    public static javax.swing.JTextArea areaObservacion;
    private javax.swing.JButton botonListadoClientes;
    private javax.swing.JButton botonListadoCobradores;
    private javax.swing.JButton botonListadoUsuarios;
    public static javax.swing.JButton botonModificar;
    public static javax.swing.JTextField campoApellido;
    public static javax.swing.JTextField campoCelular;
    public static javax.swing.JPasswordField campoContraseña;
    private org.jdesktop.swingx.JXDatePicker campoFecha;
    public static javax.swing.JTextField campoIdCliente;
    public static javax.swing.JTextField campoIdentificacion;
    public static javax.swing.JTextField campoNombre;
    public static javax.swing.JPasswordField campoReContraseña;
    public static javax.swing.JTextField campoTelefono;
    public static javax.swing.JTextField campoUsuario;
    public static javax.swing.JComboBox comboEmpresa;
    public static javax.swing.JComboBox comboRol;
    public static javax.swing.JComboBox comboTipo;
    public static javax.swing.JButton guardarPersona;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelIdentificacion;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private org.jdesktop.swingx.JXPanel jXPanel1;
    private org.jdesktop.swingx.JXPanel jXPanel3;
    private org.jdesktop.swingx.JXPanel jXPanel4;
    private javax.swing.JLabel jlabelApellido;
    private javax.swing.JLabel jlabelNombre;
    private javax.swing.JLabel labelEmpresa;
    private javax.swing.JPanel panelCliente;
    public static javax.swing.JPanel panelUsuario;
    private javax.swing.JTabbedPane tabPanel;
    // End of variables declaration//GEN-END:variables
}
